﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace TimeTracker.Provider
{
    public static class ISessionExtensions
    {
        public static TimeSpan Duration(this TimeTracker.ISession objThis)
        {
            if (objThis.EndTime.HasValue)
            {
                return objThis.EndTime.Value - objThis.StartTime;
            }

            return DateTime.Now - objThis.StartTime;
        }

        public static DateTime StartDate(this TimeTracker.ISession objThis)
        {
            return new DateTime(objThis.StartTime.Year, objThis.StartTime.Month, objThis.StartTime.Day);
        }
    }
}
